<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <style>
            .box{
                width: 100px;
                height: 100px;
                border: solid;
            }
            .container{
                width: 320px;
                height: 320px;
                border: solid;
                display: flex;
                flex-wrap: wrap;
                justify-content: center;
                align-content: center;
            }
        </style>
    </head>
    <body>
        <div class="container">
            <div class="box">1</div>
            <div class="box">2</div>
            <div class="box">3</div>
            <div class="box">4</div>
            <div class="box">5</div>
            <div class="box">6</div>
            <div class="box">7</div>
            <div class="box">8</div>
            <div class="box">9</div>
        </div>
    </body>
</html>